<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="net.sf.json.JSONObject"%>
<%@ page import="com.houdoudou.bean.*"%>
<% List<Owner> owners= new ArrayList<Owner>(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<%@ include file="validProgrammer.jsp" %>
<script language="javascript">
<!--
function changeTo(whichOne){

window.location.href=whichOne;

}
-->
</script>
</head>
<body>
<h1 align="center">业主管理</h1>    
  
        <form action="<%=request.getContextPath()%>/programmer4Jsp">
    <input type="hidden" name="affair" value="searchOwner" /><br/>
    电话： <input type="text" name="telnum"  />
    <input type="submit" value="搜索"> <br/>
    </form> 
   
<table width="100%">
 <tr>  
 <th width="12.5%"  style="BACKGROUND-COLOR: #FF0000" >电话</th> 
   <th width="12.5%" style="BACKGROUND-COLOR: #FF0000"> 密码</th>  
   <th width="12.5%" style="BACKGROUND-COLOR: #FF0000"> 名称</th>
    <th width="12.5%" style="BACKGROUND-COLOR: #FF0000"  >地址</th> 
     <th width="12.5%" style="BACKGROUND-COLOR: #FF0000"  >服务电话</th> 
      <th width="12.5%" style="BACKGROUND-COLOR: #FF0000"  >厚豆提成</th> 
       <th width="12.5%" style="BACKGROUND-COLOR: #FF0000"  >启用配置</th> 
        <th width="12.5%" style="BACKGROUND-COLOR: #FF0000"  >操作</th> 
     </tr> 

 <% boolean success; 
    Object temp =request.getAttribute("success");
     if(temp==null){
     success=false;
     }else{
       success= (Boolean) temp;
     }
    if(success) {
     owners= ( List<Owner>) request.getAttribute("owners"); }
    
   
        for (int i = 0; i < owners.size(); i++) {     
             pageContext.setAttribute("owner", owners.get(i));   
              if(owners.get(i).getIsAuth()==0){pageContext.setAttribute("authWord","未配置");}
             if(owners.get(i).getIsAuth()==1){pageContext.setAttribute("authWord","已启用"); }   
             if(owners.get(i).getIsAuth()==2){pageContext.setAttribute("authWord","未启用"); } 
                pageContext.setAttribute("row", i % 2 != 0 ? "odd" : "even"); %>           
                       <tr>           
                                    <td>${owner.telnum}</td>               
                                    <td>${owner.secret}</td>    
                                    <td>${owner.name}</td>        
                                    <td>${owner.address}</td>        
                                    <td>${owner.serviceTelnum}</td>  
                                     <td>${owner.rate}</td>     
                                     <td>${authWord}</td>    
                       <td><a href="<%=request.getContextPath()%>/programmer4Jsp?affair=modifyOwner&telnum=${owner.telnum}">修改</a> |
                        <a href="<%=request.getContextPath()%>/programmer4Jsp?affair=deleteOwner&telnum=${owner.telnum}">删除</a> </td>           
                             </tr> 
<%} %>
  
 </table>  
 <br/>   <br/>   <br/>  
</body>
</html>
<script> 
//取出传回来的参数error并与yes比较
  var errorInfoA ='<%=request.getParameter("errorInfo")%>';
  var  errorInfo=decodeURI(errorInfoA);
  if(errorInfo!='null'){
   alert(errorInfo);}

</script>